package net.tv90.bfmccore.game;

import net.tv90.bfmccore.util.area.Area;
import net.tv90.bfmccore.util.area.Area3i;
import net.tv90.bfmccore.util.area.CircleArea;
import net.tv90.bfmccore.util.area.RectangleArea3i;
import net.tv90.bfmccore.util.vector.Vector2i;
import net.tv90.bfmccore.util.vector.Vector3i;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

public enum EnumAreaType implements Serializable {

    RectangleArea3i {
        @Override
        public Area getInstance(List<List<Integer>> pointList, List<Integer> paramList) {
            Vector3i corner1 = new Vector3i(pointList.get(0).get(0), pointList.get(0).get(1), pointList.get(0).get(2));
            Vector3i corner2 = new Vector3i(pointList.get(1).get(0), pointList.get(1).get(1), pointList.get(1).get(2));
            return new RectangleArea3i(corner1, corner2);
        }
    },

    CircleArea3i {
        @Override
        public Area getInstance(List<List<Integer>> pointList, List<Integer> paramList) {
            Vector2i center = new Vector2i(pointList.get(0).get(0), pointList.get(0).get(1));
            int radius = paramList.get(0);
            int minHeight = paramList.get(1);
            int maxHeight = paramList.get(2);
            return new CircleArea(center, radius, minHeight, maxHeight);
        }
    },

    Area3i {
        @Override
        public Area getInstance(List<List<Integer>> pointList, List<Integer> paramList) {
            List<Vector2i> list = new ArrayList<>();
            for (List<Integer> ints : pointList) {
                list.add(new Vector2i(ints.get(0), ints.get(1)));
            }
            return new Area3i(list, paramList.get(0), paramList.get(1));
        }
    };

    public abstract Area getInstance(List<List<Integer>> pointList, List<Integer> paramList);
}
